package com.capgemini.business.service.impl;

import com.capgemini.business.mapper.EmployeeRecordsMapper;
import com.capgemini.business.mapper.dataobject.EmployeeRecords;
import com.capgemini.business.service.EmployeeRecordsService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class EmployeeRecordsServiceImpl implements EmployeeRecordsService {

    private final EmployeeRecordsMapper employeeRecordsMapper;

    @Override
    public List<EmployeeRecords> list() {
        return employeeRecordsMapper.selectList(null);
    }

    @Override
    public void save(EmployeeRecords employeeRecords) {
        employeeRecordsMapper.insert(employeeRecords);
    }

    @Override
    public void update(EmployeeRecords employeeRecords) {
        employeeRecordsMapper.updateById(employeeRecords);
    }

    @Override
    public void delete(Integer id) {
        employeeRecordsMapper.deleteById(id);
    }

    @Override
    public EmployeeRecords findById(Integer id) {
        return employeeRecordsMapper.selectById(id);
    }
}
